package com.jiutong.meipengdai.views.rollviewpager;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.jiutong.meipengdai.R;

/**
 * Created by suxi on 2017/6/16.
 */

public class AdvsPagerAdapter extends LoopPagerAdapter {
    private int[] imgs = {
            R.mipmap.banner,
            R.mipmap.banner2,
    };

    public AdvsPagerAdapter(RollPagerView viewPager) {
        super(viewPager);
    }

    @Override
    public View getView(ViewGroup container, int position) {
        ImageView view = new ImageView(container.getContext());
        view.setImageResource(imgs[position]);
        view.setScaleType(ImageView.ScaleType.CENTER_CROP);
        view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        return view;
    }

    @Override
    public int getRealCount() {
        return imgs.length;
    }
}
